package cloudoer.blog.service.impl;

import cloudoer.blog.base.BaseService;
import cloudoer.blog.entity.Tag;
import cloudoer.blog.service.TagService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service("tagService")
@Transactional
public class TagServiceImpl extends BaseService implements TagService{
    public List<Tag> getAll() {
        return tagMapper.selectAll();
    }

    public Tag getById(String id) {
        return tagMapper.selectByPrimaryKey(id);
    }

    public void add(Tag tag) {
        tagMapper.insertSelective(tag);
    }

    public void update(Tag tag) {
        tagMapper.updateByPrimaryKeySelective(tag);
    }

    public void delete(String id) {
        tagMapper.deleteByPrimaryKey(id);
    }
}
/*
select * from b_tag where id in (select tagId from b_article_tag where articleId = ?)
 */